[#393] Fix RPC race condition + browser client routing#394
Merged
realproject7 merged 2 commits intomainfrom Mar 20, 2026
Merged
[#393] Fix RPC race condition + browser client routing#394realproject7 merged 2 commits intomainfrom
realproject7 merged 2 commits intomainfrom
Conversation
…ient 1. BatchTokenDataProvider now exposes isReady flag. StoryCardTVL waits for batch to settle before enabling individual fallback, preventing race where individual calls fire before batch arrives. 2. getTokenPrice/getTokenTVL/get24hPriceChange accept optional client parameter. All browser components pass browserClient for CORS-safe RPC access. Server-side callers unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
approved these changes
Mar 20, 2026
Collaborator
project7-interns
left a comment
There was a problem hiding this comment.
LGTM. isReady gating correctly prevents race — individual fallback only fires after batch settles. All browser-side price/TVL functions now routed through browserClient. CI green.
Minor (not blocking): ClaimRoyalties.tsx, WriterTradingStats.tsx, and ReaderPortfolio.tsx have duplicate import lines from lib/rpc (browserClient as publicClient + browserClient). Could be merged into one import statement.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
approved these changes
Mar 20, 2026
Collaborator
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The race-condition gating and browser-client routing fixes are in place on the latest head, and CI is green.
Findings
- None.
Decision
Approved. The batch provider now exposes readiness state, browser-side individual reads use browserClient, and the latest lint-and-typecheck run passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Batch ready gating:
BatchTokenDataProvidernow exposesisReadyflag.StoryCardTVLwaits for batch to settle before enabling individual fallback queries — prevents race where individual calls fire before batch multicall arrives.Browser client routing:
getTokenPrice(),getTokenTVL(), andget24hPriceChange()now accept optionalclientparameter. All browser components passbrowserClientfor CORS-safe RPC access. Server-side callers use defaultpublicClient(unchanged).Updated files
lib/price.ts— optional client param on 3 functionssrc/components/BatchTokenDataProvider.tsx— isReady context flagsrc/components/StoryCardStats.tsx— batch gating + browserClientsrc/components/WriterTradingStats.tsx— browserClientsrc/components/ClaimRoyalties.tsx— browserClientsrc/components/ReaderPortfolio.tsx— browserClientsrc/app/dashboard/writer/page.tsx— browserClientFixes #393
Test plan
npm run typecheck— passesnpm run lint— passes🤖 Generated with Claude Code